package com.wanxi.company.controller;

import com.wanxi.common.entity.BusinessModel;
import com.wanxi.common.result.ResultDTO;
import com.wanxi.company.service.impl.BusinessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BusinessController {

    @Autowired
    private BusinessServiceImpl businessService;


    @RequestMapping("/back/business/findAll")
    public ResultDTO findAll(BusinessModel business) {
        ResultDTO resultDTO = businessService.findAll(business);
        return resultDTO;
    }



    @RequestMapping("/back/business/add")
    public ResultDTO add(BusinessModel business) {

        ResultDTO resultDTO = businessService.add(business);
        return resultDTO;
    }


    @RequestMapping("/back/business/delete")
    public ResultDTO delete(BusinessModel business) {

        ResultDTO resultDTO = businessService.delete(business);
        return resultDTO;
    }



    @RequestMapping("/back/business/findById")
    public ResultDTO findById(BusinessModel business) {
        ResultDTO resultDTO = businessService.findById(business);
        return resultDTO;
    }


    @RequestMapping("/back/business/update")
    public ResultDTO update(BusinessModel business) {

        ResultDTO resultDTO = businessService.update(business);
        return resultDTO;
    }


}
